<?php
require('../../../public/connection.php');
require('../../../class/Mysql.php');
$data = json_decode(file_get_contents('php://input'), true);
if (empty($data["notepad"]) || empty($data["weather"]) || empty($data["notepad"]) || empty($data["date"])) {
    die(json_encode(array("code" => 400, "msg" => "格式错误")));
}
$time = getDateTime();
$add_one_data = new Mysql();
$result = $add_one_data->addOrEditData(
    "insert into luggages values(null,'{$data["date"]}',{$data["week"]},'{$data["weather"]}','{$data["notepad"]}','{$time}');"
);
die(json_encode($result));
